package main

import (
	"fmt"
	"strconv"
)

func solution(a, b int) int {
	var result []int
	aStr := strconv.Itoa(a)
	bStr := strconv.Itoa(b)

	for i := 0; i <= len(aStr); i++ {
		newStr := aStr[:i] + bStr + aStr[i:]
		num, _ := strconv.Atoi(newStr)
		result = append(result, num)
	}

	max := result[0]
	for _, num := range result {
		if num > max {
			max = num
		}
	}

	return max
}

func main() {
	fmt.Println(solution(76543, 4) == 765443)
	fmt.Println(solution(1, 0) == 10)
	fmt.Println(solution(44, 5) == 544)
	fmt.Println(solution(666, 6) == 6666)
}

